package com.wntms.zjy.pojo;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class Result<T> {
    private Integer code; //编码：200成功，500为失败

    private String msg; //错误信息

    private T data; //数据

    /**
     *成功返回的消息
     * @param object
     * @return
     * @param <T>
     *
     */
    public static <T> Result<T> success(T object,String msg) {
        Result<T> r = new Result<T>();
        r.data = object;
        r.code = 200;
        r.msg=msg;
        return r;
    }

    /**
     *
     * @param msg
     * @return
     * @param <T>
     */
    public static <T> Result<T> error(String msg) {
        Result r = new Result();
        r.msg = msg;
        r.code = 500;
        return r;
    }
}
